﻿using CleanArchitecture.Infrastructure.Entities.SystemTasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace CleanArchitecture.Infrastructure.DataMapping.SystemTasks
{
    /// <summary>
    /// Represents a schedule task mapping configuration
    /// </summary>
    public partial class SystemTaskMap : NowaEntityTypeConfiguration<SystemTask>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<SystemTask> builder)
        {
            builder.ToTable("sys_task");
            builder.HasKey(task => task.Id);

            builder.Property(task => task.TaskName).HasMaxLength(200).IsRequired();
            builder.Property(task => task.GroupName).HasMaxLength(200).IsRequired();
            builder.Property(task => task.Interval).HasMaxLength(50).IsRequired();
            builder.Property(task => task.Type).IsRequired();

            base.Configure(builder);
        }

        #endregion
    }
}
